package org.grottarossa.ui.core.casemanagement.menu;

import org.grottarossa.template.drivers.DriverException;
import org.grottarossa.ui.core.ApplicationSession;
import org.grottarossa.ui.core.BPMResource;
import org.grottarossa.ui.core.base.BasePanel;


import com.vaadin.event.ItemClickEvent.ItemClickListener;
import com.vaadin.ui.Panel;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window.Notification;

public class QueriesMenuPanel extends BasePanel
{
	private static final long serialVersionUID = -3240389848752212245L;

	public QueriesMenuPanel(ApplicationSession appSession, String sApp, String sMenu, String sCaption, ItemClickListener itemClickListener)
	{
		super(appSession, null);
		initialize(sApp, sMenu, sCaption, itemClickListener);
	}

	private void initialize(String sApp, String sMenu, String sCaption, ItemClickListener qml)
	{
		this.setCaption(sCaption);
		this.setIcon(BPMResource.ICON_CASE_TASK);
		this.setScrollable(true);

		VerticalLayout vLayout = new VerticalLayout();
		vLayout.setMargin(false);

		FunctionTreeMenu services;

		try
		{
			services = new FunctionTreeMenu(m_appSession, qml,sApp, sMenu);
			vLayout.addComponent(services);
			addComponent(vLayout);
		}
		catch (DriverException e)
		{
			e.printStackTrace();
			getWindow().showNotification(e.getMessage(),Notification.TYPE_ERROR_MESSAGE);
		}

	}

	@Override
	protected void initializeComponents() {
		// TODO Auto-generated method stub

	}
}
